package cn.lingyangwl.agile.food.core.assembly;

import cn.lingyangwl.agile.model.BaseAssembly;
import cn.lingyangwl.agile.food.model.entity.ShopStore;
import cn.lingyangwl.agile.food.model.rqrs.store.StoreResp;
import cn.lingyangwl.agile.food.model.rqrs.store.StoreSaveReq;
import cn.lingyangwl.agile.food.model.rqrs.store.StoreSettingReq;
import cn.lingyangwl.agile.food.model.rqrs.store.StoreUpdateReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 门店
 *
 * @author shenguangyang
 */
@Mapper(componentModel = "spring")
public interface StoreAssembly extends BaseAssembly {
  @Mappings({
      @Mapping(source = "deliveryWays", target = "deliveryWays", qualifiedByName = STR_TO_LIST),
  })
  StoreResp toStoreResp(ShopStore source);

  ShopStore toStore(StoreSaveReq source);

  ShopStore toStore(StoreUpdateReq source);

  @Mappings({
      @Mapping(source = "deliveryWays", target = "deliveryWays", qualifiedByName = LIST_TO_STR),
  })
  ShopStore toStore(StoreSettingReq source);
}
